package cn.edu.zhku.dto;

import cn.edu.zhku.pojo.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class UserDto extends BaseDto {
    @ApiModelProperty("用户名，登录账号，唯一")
    private String username;
    @ApiModelProperty("密码，登录密码")
    private String password;
    @ApiModelProperty("学号，唯一")
    private String no;
    @ApiModelProperty("真实姓名")
    private String realname;

    public User getUser() {
        User user = new User();
        user.setUserId(this.userId);
        if (this.username != null)  user.setUsername(this.username.trim());
        user.setPassword(this.password);
        if (this.no != null) user.setNo(this.no.trim());
        if (this.realname != null) user.setRealname(this.realname.trim());
        return user;
    }

}
